package com.twinkle.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.twinkle.dao.ClusterParamMapper;
import com.twinkle.model.ClusterParam;
import com.twinkle.model.ClusterParamUI;
import com.twinkle.service.ClusterParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.util.List;

/**
 * @title: KmeansParamServiceImpl
 * @description:
 * @author: Paul
 * @date: 2023/3/14 14:07
 */
@Service
public class ClusterParamServiceImpl implements ClusterParamService {

    @Autowired
    ClusterParamMapper clusterParamMapper;

    @Override
    public ClusterParam getAlgoById(int id) {
        return null;
    }

    @Override
    public String getAllKMeansParamJson(int page, int count) {
        return null;
    }

    @Override
    public String getAllKMeansParamUIJson(int page, int count) {
        return null;
    }

    @Override
    public String kMeansParamListForUserAdd() {
        return null;
    }

    @Override
    public String addKMeansParam(ClusterParamUI clusterParamUI) throws ParseException {
        ClusterParam clusterParam = new ClusterParam();
        clusterParam.setId(clusterParamUI.getId());
        clusterParam.setAppName(clusterParamUI.getAppName());
        clusterParam.setDataSourceId(clusterParamUI.getDataSourceId());
        clusterParam.setTableName(clusterParamUI.getTableName());
        clusterParam.setFeatureCols(JSONObject.toJSONString(clusterParamUI.getFeatureCols()));
        clusterParam.setPreProcessMethodList(JSONObject.toJSONString(clusterParamUI.getPreProcessMethodList()));
        clusterParam.setAlgoParam(JSONObject.toJSONString(clusterParamUI.getAlgoParam()));
        int insert = clusterParamMapper.insert(clusterParam);
        return "sucess";
    }

    @Override
    public String modifyKMeansParam(ClusterParam clusterParam) {
        return null;
    }

    @Override
    public String deleteKMeansParam(String id) {
        return null;
    }

    @Override
    public List<ClusterParam> getAllKMeansParam() {
        return null;
    }
}
